const path = require('path')
function resolve(dir) {
  return path.join(__dirname, dir)
}
module.exports = {
  parallel: !process.env.CIRCLECI,
  css: {
    loaderOptions: {
      less: {
        javascriptEnabled: true
      }
    }
  },
  devServer: {
    open: true,
    overlay: {
      warnings: false,
      errors: false
    },
    port: 1234
  },
  chainWebpack: config => {
    config.resolve.symlinks(true);
    config.resolve.alias
    .set('@', resolve('./src'))
    .set('_', resolve('./src/framework'))
    .set('#', resolve('./src/apps'))
  },
  configureWebpack: config => {
    const optimization = {
      splitChunks: {
        chunks: 'initial',
        minSize: 0,
        minChunks: 1,
        name: true,
        cacheGroups: {
          settings: {
            name: 'settings',
            test: /settings/
          },
          vendors: {
            name: 'vendors',
            test: /[\\/]node_modules[\\/]/,
            chunks: 'all',
            priority: -10
          }
        }
      }
    }
    Object.assign(config, {
      optimization
    })
  }
};
